﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using System.Windows.Forms;

namespace deneme
{
    class ClassScalar
    {
         SqlConnection con = new SqlConnection(ClassSqlConnection.ConnectionString);
        public SqlCommand cmd = new SqlCommand();

        public Object CommScalar(string sqlQuery, CommandType commandType)
        {
            try
            {
                object obj;
                cmd.Connection = con;
                cmd.CommandText = sqlQuery;
                cmd.CommandType = commandType;
                if (con.State != ConnectionState.Open)
                    con.Open();
                obj = cmd.ExecuteScalar();

                return obj;
            }
            catch (Exception ex)
            {

                MessageBox.Show("Data", ex.Message.ToString() + "-" + sqlQuery.ToString());
                con.Close();
                return null;
            }







        }





        }
    }

